using System.IO;
using System.Security.Policy;
using System.Xml;

namespace ImpEx.Engine
{
    public abstract class FSBase : WSSObject
    {
        public string Path { get; protected set; }


        public FSBase(WSSObject parentObj)
            : base(parentObj)
        {
        }

        protected override bool EqualTo(WSSObject wssobject)
        {
            return (GetType() == wssobject.GetType() &&
                Path.ToLowerInvariant().CompareTo(((FSBase)wssobject).Path.ToLowerInvariant()) == 0);
        }

        public override XmlNode Serialize(XmlDocument document, XmlNode rootNode)
        {
            XmlNode tmpNode = base.Serialize(document, rootNode);

            if (tmpNode == null)
                tmpNode = XmlHelper.AppendElement(rootNode, StaticName);

            XmlHelper.SetAttribute(tmpNode, "Path", Path);
            return tmpNode;
        }

        public override void Deserialize(XmlNode node)
        {
            base.Deserialize(node);
            Path = node.Attributes["Path"].Value;
        }
    }
}